home *** CD-ROM | disk | FTP | other *** search
- Path: axe.netdoor.com!news
- From: esargent@netdoor.com (Eric Sargent)
- Newsgroups: comp.lang.c
- Subject: Q: realloc->free?
- Date: Sun, 14 Jan 1996 07:08:29 GMT
- Organization: Internet Doorway, Inc.
- Message-ID: <4daa2e$oh5@axe.netdoor.com>
- NNTP-Posting-Host: port96.netdoor.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- This is probably a dumb question, but I can't find any specific or
- exact information about this. Given this:
-
- char *a, *b;
-
- a = malloc(10);
- ...
- /*
- later we need to increase the size
- */
- ...
- b = realloc(a, 100);
-
- Now let's say realloc had to move the data so a != b. Does realloc
- free the memory previously pointed to by a or should it be explicitly
- freed if realloc returns a new location? I checked the FAQ, but there
- was nothing specific about realloc. Thanks for any information.
-
-
- ----
- Eric
- esargent@netdoor.com
- http://www2.netdoor.com/~esargent
-
-
-